package net;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.HashSet;

public class UdpDictServe extends UdpEchoServer{
    private HashMap<String,String> dict=new HashMap<>();


    public UdpDictServe(int port) throws SocketException {
        super(port);

        dict.put("cat","小猫");
        dict.put("dog","小狗");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"没有找到翻译");
    }

    public static void main(String[] args) throws IOException {
        UdpEchoServer server=new UdpEchoServer(9090);
        server.start();
    }
}
